package com.example.springboot_mvc_demo.config;

import com.example.springboot_mvc_demo.Interceptor.TimeInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * @Author: ideaAdmin
 * TODO: 把自定义的类 注册为 webmvc的配置
 * Description:
 */

@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //设置拦截的请求路径是：/form下面的所有
        registry.addInterceptor(new TimeInterceptor())
                .addPathPatterns("/form/**")
                //.excludePathPatterns()
                .order(0);
    }
}
